package main

import (
	"github.com/cz-it/aps/src/config"
	"github.com/cz-it/aps/src/log"

	"github.com/cz-it/golangutils/daemon"
	
	"net"
	"net/http"
	"strconv"
)

type Server struct {

}

func NewServer() *Server {
	svr := new(Server)
	return svr
}

func (svr *Server) Init() {
	InitRouter()
}

func (svr *Server) Daemon() {
	daemon.Boot(config.LockFile,config.PidFile)
}

func (svr *Server) Run() {
	log.Debug("server::run")

	err := http.ListenAndServe(net.JoinHostPort(config.IP,strconv.Itoa(config.Port)),nil)
	if err != nil {
		panic(err)
	}
}










